<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>[|.siteName|]</title>
    [|if .zTree|]
    <link rel="stylesheet" href="/static/zTree3/css/demo.css?t=5" type="text/css">
    <link rel="stylesheet" href="/static/zTree3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    [|end|]
    <meta charset="utf-8">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/main.css">
    <script src="/static/layui/layui.js?s=36"></script>
    <script src="/static/js/main.js?s=2124"></script>
    <pre lay-encode="true"></pre>
</head>
<body>
<div class="layui-layout layui-layout-admin" style="padding-left: 30px;">
 
   
    <div class="layui-form-item">
        <!--<form class="layui-form" lay-filter="sysroominfoquery" action="/sysroomconf/table" method="post"> -->
        <form class="layui-form" lay-filter="sysroominfoquery" >
            <div class="layui-inline">
                <label class="layui-form-label" style="margin-top: 10px;">房间信息：</label>
                <div class="layui-input-inline" style="margin-top: 10px;">
                    <input type="text" name="sys_room_info" id="sys_room_info" lay-verify="text" autocomplete="off"  class="layui-input">
                </div>
                <label class="layui-form-label">房间当日输赢信息：</label>
                 <div class="layui-input-inline" style="margin-top: 10px;">
                    <select name="sys_today_Win" id ="sys_today_Win">
                        <option value="">--请选择--</option>
                        <option value="0">赢        </option>
                        <option value="1">输        </option> 
                    </select>
                </div>
                <div class="layui-btn-group" style="margin-top: 10px;" >
                    <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="queryBtn">查询</button>
                </div>
             </div>
        </form>
    </div> 

    <table  class="layui-table" id = 'RoomInfoTatble' lay-size="sm" lay-filter="layfilterRoomInfo"> </table>
    <script type="text/html" id="roomtablebar">
        <div class="layui-btn-group" > 
             <td> 
                <a class="layui-btn-xs" lay-event="bloodContrl" >血池控制</a>
                <a class="layui-btn-xs" lay-event="bloodList">血池控制列表</a>
                <a class="layui-btn-xs" lay-event="hiseatpuke">历史吞吐</a>
                <a class="layui-btn-xs" lay-event="modfyconf">修改配置</a>
                <a class="layui-btn-xs" lay-event="lockroom">锁定/解锁</a>
                <a class="layui-btn-xs" lay-event="booldchange">血池变化</a>
            </td>
        </div>
    </script>

    <script type="text/html" id="TotalWinTpl">
      {{#  if(d.TotalWin > 0 ){ }}
        <span style="color: #FF0000;">{{ d.TotalWin }}</span>
      {{#  } else { }}
        {{ d.TotalWin }}
      {{#  } }}
    </script>

    <script type="text/html" id="TodayWinTpl">
      {{#  if(d.TodayWin > 0 ){ }}
        <span style="color: #FF0000;">{{ d.TodayWin }}</span>
      {{#  } else { }}
        {{ d.TodayWin }}
      {{#  } }}
    </script>

    <script type="text/html" id="RoomStatusTpl">
        {{#  if(d.RoomStatus == 0 ){ }}
            <span style="color: #00FF00;">正常</span>
        {{#  } else { }}
             <span style="color: #FF0000;">锁定</span>
        {{#  } }}
    </script>
   
</div>


<script>

    var $;

    layui.config({
            base : "js/"
    }).use(['table','form','element','layer','jquery'], function(){
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        $ = layui.jquery;
    //监听表格复选框选择
   // table.on('checkbox(demo)', function(obj){
    //   console.log(obj);
   // });
   // button.on('button(sysroominfoquery)', function(obj){
     //   if(obj.event === 'querroominfo'){
       //     layer.msg('1111111111111'); 
       // }
       // console.log(obj);
    //}

//方法级渲染


    GetMyTables(table)
    //监听工具条
    table.on('tool(layfilterRoomInfo)', function(obj){
        var data = obj.data;
       if(obj.event === 'bloodContrl'){
             window.location.href="/sysroomconf/bloodcontrl.html?ServerID="+data.ServerID
        } else if(obj.event === 'bloodList'){
            window.location.href="/sysroomconf/bloodcontrllist.html?ServerID="+data.ServerID
        } else if(obj.event === 'hiseatpuke'){
           
             window.location.href="/sysroomconf/hiseatpukelist.html?ServerID="+data.ServerID+"&RoomName="+data.RoomName
             //window.location.href="/sysroomconf/edit?id="+data.ServerID
           
        } else if(obj.event === 'modfyconf'){
            window.location.href="/sysroomconf/modifyroomconf.html?ServerID="+data.ServerID
        } else if(obj.event === 'lockroom'){
                var msgdata = '真的要【锁定】 '
                if(data.RoomStatus == 1)
                {    
                   msgdata = '真的要【解锁】 '
                }
                layer.confirm(msgdata+data.RoomName+'('+ data.ServerID + ')  么！' , function(index){
                    var jsData = {
                                    'Server_ID':data.ServerID
                                    ,'Allow_Enter':data.RoomStatus
                                    ,'Del_Type':2
                                    ,'r_ID':data.Rid
                                }
                    $.post('[|urlfor "SysRoomconfController.AjaxDel"|]', jsData, function (out) {
                        if(out.status == 0)
                        {
                            GetMyTables(table)
                        }
                         layer.msg(out.message)
                    }, "json");
                });

        }else if(obj.event === 'booldchange'){
 
            window.location.href="/sysroomconf/bloodchangelist.html?ServerID="+data.ServerID
        } 
    });



    form.on('submit(queryBtn)', function(data) {
        GetMyTables(table);
       // var data1 = GetDataFiled()
       // layer.alert(JSON.stringify(data1), {
        //        title: '最终的提交信息'
       // }) 

        return false;
    });
  
});
function GetMyTables(thisTabble){
 
    var myRoomInfo =  document.getElementById("sys_room_info");
    var systodayWin = document.getElementById("sys_today_Win");
    thisTabble.render({
        elem: '#RoomInfoTatble'
        ,url:'/sysroomconf/table'
        ,cellMinWidth: 100
        ,where: {
                sys_room_info: myRoomInfo.value
                ,sys_today_Win: systodayWin.value
            }
        ,cols: [[ //标题栏
            {field:'ServerID',  title:'SerVerID',sort:true,width:95}
            ,{field:'RoomName',title:'房间',width:100 }
            ,{field:'TotalWin', title:'总输赢',width:100,templet:'#TotalWinTpl'}
            ,{field:'TodayWin', title:'当日输赢', width:100,templet:'#TodayWinTpl'} 
            ,{field:'TodayLose',title:'当日亏损',width:100}
            ,{field:'TotalLose',title:'总亏损',width:100}
            ,{field:'PoolScore',title:'彩池',width:100}
            ,{field:'BloodBancle',title:'血池平衡值',width:100}
            ,{field:'Bloods', title:'当前剩于血池',width:125}
            ,{field:'MuteEatP', title:'负分吃分作弊率',height:300,width:125}
            ,{field:'EatP', title:'吃分作弊率',width:100}
            ,{field:'RoomStatus', title:'状态',width:80,templet:'#RoomStatusTpl'}
            ,{field:'PukeP', title:'吐分率',width:80}
            ,{field:'TaxRate', title:'税率',width:70}
            ,{field:'RobotCount',title:'机器人',width:75}
            ,{title:'',width:1,align:'center',rules:'all',toolbar:'#roomtablebar' }
                ]] 
        ,skin: 'row' //表格风格
        ,even: true
        ,page: true //是否显示分页
        ,limits: [20]
        ,limit: 20 //每页默认显示的数量
        ,width: 'full-10'
        ,rules: 'all'
        ,height: 'full-155'
    });
}

</script>
</body>
</html>